#
#
#
#
# Name:         AiScript_Aq.tcl
#
# Version:      0.1
#
# Date:         2006-10-03
#
# Description:  Ai Script For Mobs In Aq40
#
# Author:       Elonar
#
# Changelog: 
#
# No changeLog yet since it it the first version !
#
#

namespace eval ::AnubisathSentinel {
    proc CanCast { npc victim } {
        set spell_list "2147 19643 17547 25778 26046 26555 19595 25777 26554"
        # Mend Wound, Mortal Strike(150%), Mortal Strike(200%), Knock Away, Mana Burn, Shadow Storm, Shadow and Frost Reflect, Thorns, Thunderclap
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::AnubisathWarder {
    proc CanCast { npc victim } {
        set spell_list "24648 26072 23207 26073"
        # Entangling Roots, Dust Cloud, Silence, Fire Nova
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::ObsidianEradicator {
    proc CanCast { npc victim } {
        set spell_list "25671 26458"
        # Drain Mana, Shock Blast
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::ObsidianNullifier {
    proc CanCast { npc victim } {
        set spell_list "26787 25671 27794"
        # Nulify, Drain Mana, Cleave
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::QirajiBrainWasher {
    proc CanCast { npc victim } {
        set spell_list "26049 26143 11446"
        # Mana Burn, Mind Flay, Mind Control
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::QirajiLasher {
    proc CanCast { npc victim } {
        set spell_list "29484 26050 26686"
        #Web Spray, Acid Spit, Whirlwind
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::QirajiChampion {
    proc CanCast { npc victim } {
        set spell_list "27794 25778 20511 28798"
        # Cleave, Knock Away, Intimidatting Shout, Enrage
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::QirajiMindSlayer {
    proc CanCast { npc victim } {
        set spell_list "26143 26048 11446 26049"
        # Mind Blast, Mind Blast, Mind Control, Mana burn(fear effect)
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::VeknissGuardian {
    proc CanCast { npc victim } {
        set spell_list "28405 25788 26025"
        # Knockback, Knock Away, Impale
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval :VeknissHiveCrawler {
    proc CanCast { npc victim } {
        set spell_list "26052 25810 25809"
        # Poison Bolt, Mindnumbing Poison, Crippling Poison
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::VeknissSoldier {
    proc CanCast { npc victim } {
        set spell_list "27794"
        # Cleave
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::VeknissStinger {
    proc CanCast { npc victim } {
        set spell_list "25191 25190"
        # Stinger Charge, Stinger Charge(random)
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::VeknissWasp {
    proc CanCast { npc victim } {
        set spell_list "25185 25187"
        # Itch, Hive Zara Catalist
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

#--Bosses--#

namespace eval ::Viscidus {
    proc CanCast { npc victim } {
        set spell_list "25994 25865"
        # Membrane Of Viscidus, Summon Glob Of Viscidus
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}
    
namespace eval ::Huhuran {
    proc CanCast { npc victim } {
        set mobh [ ::GetHealthPCT $npc ]
        set spell_list "26052 26051 26180 26050 24857"
        # Frenzy, Poison Bolt, Wivern Poison, Acid Spit
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $mobh <= 25 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 25991 ]
            # Poison Bolt Volley
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 26053 ]
            # Noxious Posion
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 26068 ]
            # Berserk
        }
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::Skeram {
    proc CanCast { npc victim } {
        set mobh [ ::GetHealthPCT $npc ]
        set spell_list "785 25679 24685 12001 15708 24857"
        # True Fulfillment, Arcane Explosion, EarthShock,
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $mobh <= 25 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 747 ]
            # Summon Images
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 747 ]
            # Summon Images
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 747 ]
            # Summon Images
        }
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}



namespace eval ::LordKri {
    proc CanCast { npc victim } {
        set spell_list "25812 27794 23861"
        # Toxic Volley, Cleave, Summon Poison Cloud
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::PrincessYauj {
    proc CanCast { npc victim } {
        set spell_list "26641 28315 25812"
        # Fear, Heal, Toxic Volley
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::Vem {
    proc CanCast { npc victim } {
        set spell_list "22592 25778 25651 25788 20677"
        # Knockdown, Knockaway, Berserker Rage, Chill, Cleave
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::Vek'nilash {
    proc CanCast { npc victim } {
        set spell_list "800 26662 26007 26613 802"
        # Twin Teleport, Berserk, Uppercut, Unbalancing Strike, Mutate Bug
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::Vek'lor {
    proc CanCast { npc victim } {
        set spell_list "800 26662 26006 26607 804 568"
        # Twin Teleport, Berserk, Blizzard, Arcane Burst, Explode Bug
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::Fankriss {
    proc CanCast { npc victim } {
        set mobh [ ::GetHealthPCT $npc ]
        set spell_list "22937 23861 25646"
        # Poison Bolt, Poison Cloud, Mortal Wound
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $mobh <= 25 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 28798 ]
            # Enrage
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 26229 ]
            # Summon Player
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 25725]
            # Paralyse
        }
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}


namespace eval ::Ouro {
    proc CanCast { npc victim } {
        set mobh [ ::GetHealthPCT $npc ]
        set spell_list "26103 26102 26058 26060 26100 26093"
        # Sweep, Sand Blast, Summon Ouro Mounds, Summon Ouro Scarabs, Quaqe
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $mobh <= 25 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 17742 ]
            # Disease Cloud 1
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 19798 ]
            # Earthquaqe
        }
        if { $spellid == 0 && $mobh <= 25 } {
            set spellid [ ::AI::Check $npc $victim 28798 ]
            # Enrage
        }
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}


namespace eval ::EyeOfCThun {
    proc CanCast { npc victim } {
        set mobh [ ::GetHealthPCT $npc ]
        set spell_list "26134 26029 26152 26100 26144  26397 26140"
        # Eye Beam, Void Bolt, Strong Cleave, Thunderclap, Manastorm
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $mobh >= 80 && $mobh<= 90 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 26044 ]
            # Mind Flay
        }
        if { $mobh >= 70 && $mobh <= 80 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 24838 ]
            # Shadow Bolt Whirl
        }
        if { $mobh >= 60 && $mobh <= 70 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 23011 ]
            # Tears Of The Windseeker
        }
        if { $mobh >= 50 && $mobh <= 60 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 9256 ]
            # Deep Sleep
                }
                if { $mobh >= 1 && $mobh <= 60 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 26232 ]
            # Transform C'thun
                }
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}

namespace eval ::C'thun {
    proc CanCast { npc victim } {
        set mobh [ ::GetHealthPCT $npc ]
        set spell_list "26156 26769 26152 26100 26144 26213 26766 26332 26476"
        # Carapace Of C'thun, Summon Eye Tentacles, Summon Eye Tentacles, Summon Giant Flesh Tentacles, Summon Giant Eye Tentacles, Summon Mouth Tentacles, Digestive Acid
        set spellid [ ::AI::Check $npc $victim 18116 ]
        # Anti-Stun
        if { $mobh >= 80 && $mobh<= 90 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 26044 ]
            # Mind Flay
        }
        if { $mobh >= 70 && $mobh <= 80 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 24838 ]
            # Shadow Bolt Whirl
        }
        if { $mobh >= 60 && $mobh <= 70 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 23011 ]
            # Tears Of The windseeker
        }
        if { $mobh >= 50 && $mobh <= 60 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 17439 ]
            # Shadow Shock
                }
                if { $mobh >= 1 && $mobh <= 60 && $spellid == 0 } {
            set spellid [ ::AI::Check $npc $victim 12787 ]
            # Thrash
                }
        if { $spellid == 0 } {
            set spellid [ lindex $spell_list [ expr { int( rand() * [ llength $spell_list ] ) } ] ]
        }
        return [ ::AI::Cast $npc $victim $spellid ]
    }
}
